﻿using System.Text;

namespace WeixinSDK
{
    class WxWebClient : System.Net.WebClient
    {
        public WxWebClient()
        {
            Encoding = Encoding.UTF8;
        }

        public static string HttpGet(string url)
        {
            return new WxWebClient().DownloadString(url);
        }

        public static string HttpPost(string url, string postData)
        {
            var wc = new WxWebClient();
            wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            wc.Headers.Add("ContentLength", postData.Length.ToString());
            return wc.UploadString(url, "POST", postData);
        }
    }
}
